package com.zhou.base.flowable7.test.config.idm;

import org.flowable.common.engine.impl.AbstractEngineConfiguration;
import org.flowable.common.engine.impl.interceptor.EngineConfigurationConstants;
import org.flowable.idm.engine.IdmEngineConfiguration;
import org.flowable.idm.engine.configurator.IdmEngineConfigurator;

/**
 * @author xianfeng
 * @description:
 * @date 2024/1/11 18:28
 */
public class CustomIdmEngineConfigurator extends IdmEngineConfigurator {

    protected static IdmEngineConfiguration getIdmEngineConfiguration(AbstractEngineConfiguration engineConfiguration) {
        return (IdmEngineConfiguration) engineConfiguration.getEngineConfigurations().get(EngineConfigurationConstants.KEY_IDM_ENGINE_CONFIG);
    }

    @Override
    public void beforeInit(AbstractEngineConfiguration engineConfiguration) {
        // Nothing to do
    }

    @Override
    public void configure(AbstractEngineConfiguration engineConfiguration) {

        //初始化配置


        super.configure(engineConfiguration);

        getIdmEngineConfiguration(engineConfiguration)
                .setIdmIdentityService(new CustomIdmIdentityServiceImpl(idmEngineConfiguration));
    }

//    public LDAPConfiguration getLdapConfiguration() {
//        return ldapConfiguration;
//    }
//
//    public void setLdapConfiguration(LDAPConfiguration ldapConfiguration) {
//        this.ldapConfiguration = ldapConfiguration;
//    }
}
